Skip to content

perf: save bandwidth on dead bodies, CopyToBodyQue#79

Open
WofWca wants to merge 1 commit into
ec-:masterfrom
WofWca:save-CopyToBodyQue-bandwidth-1
Open

perf: save bandwidth on dead bodies, CopyToBodyQue#79
WofWca wants to merge 1 commit into
ec-:masterfrom
WofWca:save-CopyToBodyQue-bandwidth-1

Conversation

@WofWca

@WofWca WofWca commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

It's easy to test this with set cl_shownet 2; set bot_pause 1
and a single bot.

Below is the diff between vanilla and this commit.
As you can see, the "new" delta is smaller,
some fields (angles, etc) are omitted.

    22: #1 remove
-24: #64 pos.trBase[0]:392 pos.trBase[1]:1431 pos.trBase[2]:24 apos.trBase[1]:315 angles2[1]:1 еТуре:1 torsoAnim:1 legsAnim:1 groundEntityNum:1022 eFlags:1 clientNum:1 angles[1]:135 apos.trType:1 (340 bits)
-45: END OF MESSAGE
+24: #67 pos.trBase[0]:392 pos.trBase[1]:1431 pos.trBase[2]:24 ароs.trBase[1]:315 еТуре:1 torsoAnim:3 legsAnim:3 groundEntityNum:1022 eFlags:1 clientNum:1 (275 bits)
+41: END OF MESSAGE
  • Why draft? I want to test this for a bit more.
    So far things seem alright.

@WofWca

WofWca commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

I played ~30 matches with this, found no issues. I tested by looking at the dead bodies closely when the owner of the dead body respawns. They still do twitch sometimes, but this also happens on vanilla, i.e. I'm pretty sure that this doesn't have to do with this MR.

@WofWca WofWca marked this pull request as ready for review July 9, 2026 14:25
@ensiform

ensiform commented Jul 10, 2026

Copy link
Copy Markdown

How did you measure the reduced network data if I may ask?
If the value is different from what it was without setting these to 0 you're still actually sending the delta difference which may not actually save anything but end up transmitting more.

It's easy to test this with `set cl_shownet 2; set bot_pause 1`
and a single bot.

Below is the diff between vanilla and this commit.
As you can see, the "new" delta is smaller,
some fields (`angles`, etc) are omitted.

```diff
 22: ec-#1 remove
-24: ec-#64 pos.trBase[0]:392 pos.trBase[1]:1431 pos.trBase[2]:24 apos.trBase[1]:315 angles2[1]:1 еТуре:1 torsoAnim:1 legsAnim:1 groundEntityNum:1022 eFlags:1 clientNum:1 angles[1]:135 apos.trType:1 (340 bits)
-45: END OF MESSAGE
+24: ec-#67 pos.trBase[0]:392 pos.trBase[1]:1431 pos.trBase[2]:24 ароs.trBase[1]:315 еТуре:1 torsoAnim:3 legsAnim:3 groundEntityNum:1022 eFlags:1 clientNum:1 (275 bits)
+41: END OF MESSAGE
```
@WofWca WofWca force-pushed the save-CopyToBodyQue-bandwidth-1 branch from c82d488 to e1d1bf4 Compare July 10, 2026 07:50
@WofWca

WofWca commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

Oops, you're right. I wanted to clarify this, but forgor 💀
I edited the description.

@WofWca

WofWca commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

If the value is different from what it was without setting these to 0 you're still actually sending the delta difference which may not actually save anything but end up transmitting more.

According to the output of cl_showned, the zeroed struct is used as a basis for delta. I suspect that this has to do with the fact that the entity is initially unlinked.

I also initially wanted to go for minimizing changes, but then found this out.

@WofWca WofWca marked this pull request as draft July 10, 2026 07:58
@WofWca

WofWca commented Jul 10, 2026

Copy link
Copy Markdown
Contributor Author

the zeroed struct is used as a basis for delta

OK, I also double-checked that this is not just a logging error. With cl_shownet 3 it prints baseline as opposed to delta.
https://github.com/ec-/Quake3e/blob/a0e6451e22ea70e5530483863a6018c2d2a5c79d/code/client/cl_parse.c#L141-L167

Baselines are initialized here. Only the entity number is set there. But regardless of what the baseline is, angles and eventParm are dynamic anyway, so even if baseline is not 0 then sometimes we will still send the delta.

And one can look at just the message size. It's 45 vs 41.

@WofWca WofWca marked this pull request as ready for review July 10, 2026 08:28
@WofWca

WofWca commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

(After discovering the concept of "baselines" I went into the rabbit hole and made #81. Thanks @ensiform!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants